package cc.comac.mom.controller;

import java.util.List;

import cc.comac.mom.bean.EquipMaintainPlanBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipMaintainPlanEntityService;
import cc.comac.mom.bean.EquipMaintainPlan;
import cc.comac.mom.util.ResultBean;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping("EquipMaintainPlan")
public class EquipMaintainPlanController {
	@Autowired
	private EquipMaintainPlanEntityService equipMaintainPlanEntityService;
	@ApiOperation("新增保养计划")
	@RequestMapping(value = "/insertMaintainPlan",method = RequestMethod.POST)
	public ResultBean insertMaintainPlan (@RequestBody List<EquipMaintainPlan> equipMaintainPlan) {
		ResultBean insertMaintainPlan = equipMaintainPlanEntityService.insertMaintainPlan(equipMaintainPlan);
		return insertMaintainPlan;
	}
	@ApiOperation("通过保养计划主键批量删除保养计划")
	@RequestMapping(value = "/batchDeleteByMaintainPlanId",method = RequestMethod.POST)
	public ResultBean batchDeleteByMaintainPlanId (@RequestBody List<EquipMaintainPlan> list) {
		ResultBean batchDeleteByMaintainPlanId = equipMaintainPlanEntityService.batchDeleteByMaintainPlanId(list);
		return batchDeleteByMaintainPlanId;
	}
	@ApiOperation("通过保养计划主键更新保养计划")
	@RequestMapping(value = "/updateByMaintainPlanId",method = RequestMethod.POST)
	public ResultBean updateByMaintainPlanId (@RequestBody EquipMaintainPlan equipMaintainPlan) {
		ResultBean updateByMaintainPlanId = equipMaintainPlanEntityService.updateByMaintainPlanId(equipMaintainPlan);
		return updateByMaintainPlanId;
	}
	@ApiOperation("通过条件查询保养计划")
	@RequestMapping(value = "/selectBySomeFields",method = RequestMethod.POST)
	public ResultBean selectBySomeFields(@RequestBody EquipMaintainPlanBean obj) {
		ResultBean selectBySomeFields = equipMaintainPlanEntityService.selectBySomeFields(obj);
		return selectBySomeFields;
	}
	@ApiOperation("启用保养计划")
	@RequestMapping(value = "/changeEnable",method = RequestMethod.POST)
	public ResultBean changeEnable(@RequestBody EquipMaintainPlan equipMaintainPlan) {
		ResultBean changeEnable = equipMaintainPlanEntityService.changeEnable(equipMaintainPlan);
		return changeEnable;
	}
	@ApiOperation("发布保养计划")
	@RequestMapping(value = "/planSent",method = RequestMethod.POST)
	public ResultBean planSent (@RequestBody List<EquipMaintainPlan> list) {
		ResultBean planSent = equipMaintainPlanEntityService.planSent(list);
		return planSent;
	}
	@ApiOperation("通过位置查询对应的保养基准")
	@RequestMapping(value = "/selectBenchmarkByLocation",method = RequestMethod.POST)
	public ResultBean selectBenchmarkByLocation (@RequestBody EquipMaintainPlan equipMaintainPlan) {
		ResultBean selectBenchmarkByLocation = equipMaintainPlanEntityService.selectBenchmarkByLocation(equipMaintainPlan);
		return selectBenchmarkByLocation;
	}
	
	
	
}
